cmake_minimum_required(VERSION 3.16)
project(thread LANGUAGES CXX)

include(qt.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR}
    COMPONENTS
        Core
        Gui
        Widgets
)
qt_standard_project_setup()

set(PROJECT_SOURCES
    main.cpp
    mainwindow.ui
    mainwindow.h
    mainwindow.cpp
)

set(PRODUCERCONSUMER
    qthreadconsumer.h
    qthreadproducer.h
    producerconsumer.cpp
    qpcdialog.h
    qpcdialog.cpp
)

set(DICE_SOURCE 
    qdicethread.cpp
    qdicethread.h
    qdicedialog.h
    qdicedialog.cpp
)

qt_add_executable(thread ${PROJECT_SOURCES} ${DICE_SOURCE} ${PRODUCERCONSUMER})

set_target_properties(thread
    PROPERTIES
        WIN32_EXECUTABLE TRUE
)

target_link_libraries(thread
    PUBLIC
        Qt::Core
        Qt::Gui
        Qt::Widgets
)
